/**
**************************************************************************************
*Founder Effect                                                                      *
*Copyright (C) 2006-2007, 5d Studios (www.5d-Studios.com)                            *
*                                                                                    *
*This library is free software; you can redistribute it and/or                       *
*modify it under the terms of the GNU Lesser General Public                          *
*License as published by the Free Software Foundation; either                        *
*version 2.1 of the License, or (at your option) any later version.                  *
*                                                                                    *
*This library is distributed in the hope that it will be useful,                     *
*but WITHOUT ANY WARRANTY; without even the implied warranty of                      *
*MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU                   *
*Lesser General Public License for more details.                                     *
*                                                                                    *
*You should have received a copy of the GNU Lesser General Public                    *
*License along with this library; if not, write to the Free Software                 *
*Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301  USA      *
**************************************************************************************
*/
#pragma once
#include <string>
#include <map>

#include "geom.h"

/**
=================================================
Dictionary Entry
=================================================
*/
class DictEntry
{
public:
    DictEntry();

    /** Clear values */
    void    Clear();

    /** Destroy */
    ~DictEntry() { Clear(); };
public:
    bool            b_value;
    int             i_value;
    float           f_value;
    std::string     s_value;
    MVector3f       v_value;

    std::string     m_name;
};

/** Our Shortcuts */
typedef std::map< const std::string, DictEntry >    type_Dictionary;        // Data Structure
typedef type_Dictionary::iterator                   type_DictIter;          // Iterator

/**
=================================================
Entity Dictionary -
Holds properties of an entity
=================================================
*/
class EntDict
{
public:
  EntDict(void);

  /** Put a property into the dictionary */
  void Put( const std::string &prop, const std::string &value );
  void Put( const std::string &prop, int value );
  void Put( const std::string &prop, float value );
  void Put( const std::string &prop, bool value );
  void Put( const std::string &prop, float v1, float v2, float v3 );

  /** Get a property */
  int GetInt( const std::string &prop );
  float GetFloat( const std::string &prop );
  MVector3f GetVector3f( const std::string &prop );
  std::string GetStr( const std::string &prop );

  /** Set a property */
  void SetStr( const std::string &prop, const std::string &value );
  void SetInt( const std::string &prop, int value );
  void SetFloat( const std::string &prop, float value );
  void SetBool( const std::string &prop, bool value );
  void SetVector( const std::string &prop, MVector3f value );

  /** Clear all entries */
  void Clear();
  /** Remove a prop */
  void Remove( const std::string &prop );

  /** Test for property */
  bool Has( const std::string &prop );

  /** Iterate through the list */
  type_DictIter GetBeginning() { return m_vocab.begin(); };
  type_DictIter GetEnd()       { return m_vocab.end();   }; 
private:
    
    std::map< const std::string, DictEntry >  m_vocab;
public:
    virtual ~EntDict(void);
};
